import https from "./request";
export function loginapi(data) {
  return https({
    url: "/Login",
    method: "POST",
    data,
  });
}
export function menusapi() {
  return https({
    url: "/menus",
    method: "get",
  });
}
export function getUsersApi(params) {
  return https({
    url: "/users",
    method: "get",
    params,
  });
}
export function getStatusApi(uid, type) {
  return https({
    url: `users/${uid}/state/${type}`,
    method: "put",
  });
}
export function getSearchApi(id) {
  return https({
    url: `users/${id}`,
    method: "get",
  });
}
export function addUsersApi(data) {
  return https({
    url: "users",
    method: "post",
    data,
  });
}
export function editUsersApi(id, data) {
  return https({
    url: `users/${id}`,
    method: "put",
    data,
  });
}
export function deleteUsersApi(id) {
  return https({
    url: `users/${id}`,
    method: "delete",
  });
}
export function getRoleApi() {
  return https({
    url: "roles",
    method: "get",
  });
}
export function setroleApi(id, data) {
  return https({
    url: `users/${id}/role`,
    method: "put",
    data,
  });
}
export function getRightsApi(type) {
  return https({
    url: `rights/${type}`,
    method: "get",
  });
}
export function getRolesApi() {
  return https({
    url: "roles",
    method: "get",
  });
}
export function addRolesApi(data) {
  return https({
    url: "roles",
    method: "post",
    data,
  });
}
export function editRolesApi(id, data) {
  return https({
    url: `roles/${id}`,
    method: "put",
    data,
  });
}
export function deleteRolesApi(id) {
  return https({
    url: `roles/${id}`,
    method: "delete",
  });
}
export function fp(roleId) {
  return https({
    url: `roles/${roleId}/rights`,
    method: "post",
  });
}
export function TGRole(id,rids) {
  return https({
    url: `roles/${id}/rights`,
    method: "POST",
    data:{rids}
  });
} 
